package bookpos.action;

import java.util.List;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import bookpos.entity.Inventory;
import bookpos.entity.Orders;
import bookpos.service.InventoryService;
import bookpos.service.OrderItemService;
import bookpos.service.OrdersService;
import bookpos.service.PaymentService;
import bookpos.util.core.action.BaseAction;
import bookpos.util.core.action.Json;
import bookpos.util.core.util.ExceptionUtil;

import com.opensymphony.xwork2.ModelDriven;
/**
 * 库存控制器 InventoryAction
 * @author WZB
 *
 */
@Controller
@Action(value = "payment", results = { @Result(name = "payment", location = "/page/inventory/inventory.jsp") })
public class PaymentAction extends BaseAction implements ModelDriven<Orders> {
	private static final long serialVersionUID = 3088843221530537631L;
	private static final Logger logger = Logger.getLogger(PaymentAction.class);
	@Autowired
	private PaymentService service;
	
	private String oid;
	private String getmoney;
	private String backmoney;
	private String total;//以 ","分割商品价格
	private String status;//以 ","分割商品
	


	/**
	 * 存储支付信息
	 */
	public void saveOrders() {
			Json result = new Json();
			try {
				service.savePayment(oid, getmoney,backmoney,total,status);
				result.setSuccess(true);
				result.setMsg("保存成功");
				result.setSuccess(true);
			} catch (Exception e) {
				logger.debug(ExceptionUtil.getExceptionMessage(e));
				result.setMsg("保存失败");
			}
			writeJson(result);
	}
	
	


	@Override
	public Orders getModel() {
		// TODO Auto-generated method stub
		return null;
	}
	public String getTotal() {
		return total;
	}
	public void setTotal(String total) {
		this.total = total;
	}	
	
}
